<!DOCTYPE html>
<html>
	<head>
		{% include 'zbook/common/header.html' %}
		<title>书籍目录</title>
	</head>

	<body>
		{% include 'zbook/common/topbar.html' %}
		<!--小说名称-->
		<div class="container">
			<!--内容-->
			<div class="Fiction-content clearfix">
				<!--小说介绍-->
				<div class="Fiction-introduce clearfix">
					<div class="Fiction-introduce-img col-sm-12 col-md-3 col-xs-12">
						<img  src="{{ data.book.img }}" style="width:180px;">
						<span class="Fiction-status">共 {{ data.book.sheets }} 章</span>
					</div>
					<div class="Fiction-introduce-explai col-sm-12 col-md-9 col-xs-12">
						<h3>《{{ data.book.name }}》</h3>
						<div class="Fiction-introduce-rules clearfix">
							<span class="col-sm-12 col-md-6 col-xs-12">作者：{{ data.book.auth }}</span>
							<span class="col-sm-12 col-md-6 col-xs-12">更新时间：{{ data.book.update_time }}</span>
							<span class="col-sm-12 col-md-6 col-xs-12">章节： 共 {{ data.book.sheets }} 章 </span>
							<span class="col-sm-12 col-md-6 col-xs-12">收藏： {{ data.book.favs }}</span>
							<span class="col-sm-12 col-md-6 col-xs-12">阅读： {{ data.book.views }}</span>
							<span class="col-sm-12 col-md-6 col-xs-12">笔记： {{ data.book.notes }}</span>
						</div>
						<div class="Fiction-info-con">
							{{ data.book.desc |safe }}
						</div>
						<div class="Fiction-label">
							{% for tag in data.tags %}
							<span class="tag tag-{{tag.tid}}">{{tag.tag}}
								<a href="/catalog?bid={{data.book.id}}&rmtag={{tag.tid}}">
									<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
								</a>
							</span>
							{% endfor %}
							<button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#tagModal" data-whatever="">添加标签</button>
						</div>
						{% if data.isfav %}
						<a href="/catalog?bid={{data.book.id}}&op=unfav" class="Fiction-collect btn btn-default">移除书架</a>
						{% else %}
						<a href="/catalog?bid={{data.book.id}}&op=fav" class="Fiction-collect btn btn-default">加入书架</a>
						{% endif %}
					</div>
				</div>
				<div class="Fiction-chapter clearfix">
					<div class="Fiction-title"><i class="icon-news Fiction-icon"></i>书籍章节</div>
					<ul class="Fiction-chapter-list">
						{% for p in data.pages %}
						<li class="col-sm-12 col-md-4 col-xs-12"><a href="/read?bid={{data.book.id}}&pid={{p.sort}}">第{{p.sort}}章 {{p.title}}</a></li>
						{% endfor %}
					</ul>
				</div>
			</div>
		</div>
		<div class="modal fade" id="tagModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
								aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="exampleModalLabel">选择标签</h4>
					</div>
					<div class="modal-body">
						<form>
							<div class="form-group">
								<span class="tag tag-1">
									<input type="checkbox" class="booktag" value="1" id="mingyi" autocomplete="off" > 名医
								</span>
								<span class="tag tag-2">
									<input type="checkbox" class="booktag" value="2" id="yili" autocomplete="off" > 医理
								</span>
								<span class="tag tag-5">
									<input type="checkbox" class="booktag" value="5" id="zhengjiu" autocomplete="off" > 针炙
								</span>
								<span class="tag tag-4">
									<input type="checkbox" class="booktag" value="4" id="fangyao" autocomplete="off" > 方药
								</span>
								<span class="tag tag-3">
									<input type="checkbox" class="booktag" value="3" id="bencao" autocomplete="off" > 本草
								</span>
								<span class="tag tag-6">
									<input type="checkbox" class="booktag" value="6" id="yian" autocomplete="off" > 医案
								</span>
								<span class="tag tag-7">
									<input type="checkbox" class="booktag" value="7" id="zhushu" autocomplete="off" > 注述
								</span>
								<span class="tag tag-8">
									<input type="checkbox" class="booktag" value="8" id="zhenggu" autocomplete="off" > 正骨
								</span>
								<span class="tag tag-9">
									<input type="checkbox" class="booktag" value="9" id="tuina" autocomplete="off" > 推拿
								</span>
								<span class="tag tag-10">
									<input type="checkbox" class="booktag" value="10" id="erke" autocomplete="off" > 儿科
								</span>
								<span class="tag tag-11">
									<input type="checkbox" class="booktag" value="11" id="fuke" autocomplete="off" > 妇科
								</span>
							</div>
						</form>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" onclick="submit_tags()" id="tag_submit" class="btn btn-primary">确定</button>
					</div>
				</div>
			</div>
		</div>
		{% include 'zbook/common/footer.html' %}
	</body>
</html>
<script>
	var topnode = document.querySelector('#header-top');

	function change() {
		var bgheader = document.getElementById('integral-bgheader');
		var y = document.scrollingElement.scrollTop;
		bgheader.style.opacity = (((y / 50) > 0.9) ? 0.9 : (y / 50));
		if(y > 50) {
			topnode.classList.add("headerstyle");
		} else {
			topnode.classList.remove("headerstyle");
		}
	}
	document.addEventListener('touchmove', change);
	document.addEventListener('scroll', change);
	/**************搜索********************/
	function submit_search(){
		var name= $("#search-content").val();
		if(name!=''){
			window.location.href='/search?key='+name;
		}else{
			PromptBox('请输入查询信息!',2,false);
		}
	}
	/*-----添加标签-------*/
	function submit_tags(){
		var values = [];
        $('.booktag:checked').each(function() {
            values.push($(this).val());
        });
        tags = values.join(', ');
		window.location.href='/catalog?bid={{data.book.id}}&tags=' + tags;
	}
</script>